﻿@model Doan.Forum.Models.TopicViewModel
@{
    ViewBag.Title = "ShowTopic";
}
@{
    var topicTitle = Model.Topic.TopicTitle;
    var topicPreview = Model.FirstComment.CommentBody.Substring(0,200)+".....";
    var createUser = Model.ACreateUser.UserName;
    var logo = "../../Content/Logo/defaultLogo.jpg";
    if (Model.LastCommentUser.UserPhoto!=null)
    {
        logo = "../.." + Model.LastCommentUser.UserPhoto;
    }
    var lastUser = Model.ALastCommentUser.UserName;
    var lastDate = Model.LastDate.ToShortDateString();
    var createDate = Model.Topic.TopicCreationDate.ToShortDateString();
}

<div class="topicrow">            
    <div class="row">                
        <div class="span1 topicstats">
            <div class="topicstatsblock ">
                <div class="topicvotes">@Model.SumThanked <span>Bình chọn</span></div>
                <div class="topiccomments">@Model.Topic.Comments.Count <span>Bình luận</span></div>
            </div>
            <span class="topicviews">@Model.Topic.TopicViews Lượt xem</span>
        </div>

        <div class="span7 topicrowdetails">
            <h3><a href=@Url.Action("ShowTopic","Topic", new {id= Model.Topic.TopicId})>@topicTitle</a></h3>
                
            <div class="topicpreview"><p>@topicPreview</p>
            </div>
            <div class="topicrowstatscategory">
                Tạo vào @createDate bởi @createUser
            </div>
        </div>
                
        <div class="span1 topicrecent">
            <p class="topicrecenttitle">Bài cuối</p>
            <p class="topicrecentavatar">
                <a href=@Url.Action("ShowProfile","Account", new {userName= lastUser})><img src=@logo alt=@lastUser title=@lastUser></a>
            </p>
            <p class="topicrecentdate">@lastDate</p>
        </div>
    </div>
</div>